package com.jaws.core.common.validator;

import javax.validation.Validation;
import javax.validation.Validator;

import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider;

/**
 * 默认验证器
 * 
 * @author maojian
 * @date 2017-05-27 14:15:11
 * @since v1.0.0
 */
public class JawsValidator {

	private Validator validator;

	public JawsValidator() {
		if (null == validator) {
			validator = Validation.byProvider(HibernateValidator.class).configure().failFast(true).parameterNameProvider(new ParanamerParameterNameProvider()).buildValidatorFactory().getValidator();
		}
	}

	public Validator getValidator() {
		return validator;
	}

}
